//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_CONSOLE_H__
#define __ELASTOS_CONSOLE_H__

class ConsoleDev : public Driver {
public:
    CARAPI Read(
        /* [in] */ UINT64 u64Offset,
        /* [in] */ UINT uNumberOfBytesToRead,
        /* [out] */ EzByteBuf ebbData,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI WriteToCOM(EzByteBuf ebbData);

    CARAPI Write(
        /* [in] */ UINT64 u64Offset,
        /* [in] */ EzByteBuf ebbData,
        /* [out] */ UINT * puNumberOfBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ INT nControlCode,
        /* [in] */ EzByteBuf ebbInData,
        /* [out] */ EzByteBuf ebbOutData,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose() {}

    ECode Initialize();

    ~ConsoleDev() {

        if (m_pWriteBuf) {
            free(m_pWriteBuf);
        }
    }
public:
    char           *m_pWriteBuf;
    BOOL            m_bConsoleEnabled;
};

#endif // __ELASTOS_CONSOLE_H__
